Duplicated Code in Conditional Branches (DCCB)

Description:

DCCB detects conditional statements where both branches have the same code. Such code should be moved outside of the conditional branches.

Incorrect:

if (index + delta > limit) {
    index = limit;
    v[index] = val;
} else {
    index += delta;
    v[index] = val;
}

Correct:

if (index + delta > limit) {
    index = limit;
} else {
    index += delta;
}
v[index] = val;

Refactoring: